// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'



// createRouter 创建路由实例
const router = createRouter({
    history: createWebHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
    routes: [
        {
            path: '/',
            name: 'index',
            redirect: '/resume/1#about',
            component: () => import('@/pages/resume/Resume.vue'),
            meta: {
                requireAuth: true
            }
        },

        {
            path: '/markdown',
            name: 'markdown',
            component: () => import('@/pages/markdown/Index.vue'),
            meta: {
                requireAuth: true
            }
        },

        {
            path: '/',
            name: 'layout',
            component: () => import('@/pages/Layout.vue'),
            children: [
                {
                    path: 'resume/:id',
                    name: 'resume',
                    component: () => import('@/pages/resume/Resume.vue'),
                },
                {
                    path: 'newresume',
                    name: 'newresume',
                    component: () => import('@/pages/new/Index.vue'),
                },
                {
                    path: 'wel',
                    name: 'wel',
                    component: () => import('@/pages/welcome/Index.vue'),
                },
                {
                    path: 'projects/:id',
                    name: 'projects',

                    component: () => import('@/pages/projects/Index.vue'),
                },
                {
                    path: 'projectdetail/:id',
                    name: 'projectdetail',
                    component: () => import('@/pages/projectdetail/Index.vue'),
                },
                {
                    path: 'blogedit',
                    name: 'blog',
                    component: () => import('@/pages/blog/Edit.vue'),
                },
            ],
        },
    ],
})

// 抛出路由实例, 在 main.js 中引用
export default router